package com.wing.financeSet.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 账户
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("fin_account")
public class Account extends BaseEntity<Account> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum AccountClassify implements IEnum<Integer> {

        /**
        * 基本户
        */
        basic(0,"基本户"),
        /**
        * 一般户
        */
        ordinary(1,"一般户"),
        /**
        * 工资账户
        */
        salary(2,"工资账户");

        private int code;
        private String desc;

        AccountClassify(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum Currency implements IEnum<Integer> {

        /**
        * 人民币
        */
        rmb(0,"人民币"),
        /**
        * 美元
        */
        usd(1,"美元"),
        /**
        * 日元
        */
        jpy(2,"日元"),
        /**
        * 韩元
        */
        krw(3,"韩元"),
        /**
        * 其他
        */
        other(4,"其他");

        private int code;
        private String desc;

        Currency(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum BalanceDirection implements IEnum<Integer> {

        /**
        * 借
        */
        borrow(0,"借"),
        /**
        * 贷
        */
        loan(1,"贷");

        private int code;
        private String desc;

        BalanceDirection(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum SubjectType implements IEnum<Integer> {

        /**
        * RSA
        */
        RSA(0,"RSA"),
        /**
        * RSA2
        */
        RSA2(1,"RSA2");

        private int code;
        private String desc;

        SubjectType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 所属分类
     */
    private AccountClassify accountClassify;

    /**
    * 所属分类描述
    */
    @TableField(exist = false)
    private String accountClassifyDesc;

    public String getAccountClassifyDesc() {
        return accountClassify == null ? null : accountClassify.getDesc();
    }

    /**
     * 账户类型id
     */
    private Long accountTypeId;

    /**
     * 币种
     */
    private Currency currency;

    /**
    * 币种描述
    */
    @TableField(exist = false)
    private String currencyDesc;

    public String getCurrencyDesc() {
        return currency == null ? null : currency.getDesc();
    }

    /**
     * 部门id
     */
    private Long departmentId;

    /**
     * 默认单位
     */
    private String unitName;

    /**
     * 开户银行
     */
    private String openingBank;

    /**
     * 银行账号户名
     */
    private String bankAccountName;

    /**
     * 银行账号
     */
    private String bankAccount;

    /**
     * 客户号
     */
    private String clientNumber;

    /**
    * 启用时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    /**
     * 余额方向
     */
    private BalanceDirection balanceDirection;

    /**
    * 余额方向描述
    */
    @TableField(exist = false)
    private String balanceDirectionDesc;

    public String getBalanceDirectionDesc() {
        return balanceDirection == null ? null : balanceDirection.getDesc();
    }

    /**
     * 商户号
     */
    private String serveMerchantCode;

    /**
     * 服务商APPID
     */
    private Long facilitatorAppId;

    /**
     * 商户号
     */
    private String merchantCode;

    /**
     * 微信APPID
     */
    private Long wxAppId;

    /**
     * 微信支付密钥
     */
    private String wxPaySecretKey;

    /**
     * 微信支付证书
     */
    private String wxPaySecretCertificate;

    /**
     * 支付宝APPID
     */
    private Long alipayAppId;

    /**
     * 支付宝公钥
     */
    private String alipayPublicKey;

    /**
     * 商户公钥
     */
    private String commercialTenantPublicKey;

    /**
     * 商户私钥
     */
    private String commercialTenantSecretKey;

    /**
     * 商户授权令牌
     */
    private String authorizationToken;

    /**
     * 支付宝支付证书
     */
    private String alipayPaySecretCertificate;

    /**
     * 加密方式
     */
    private SubjectType subjectType;

    /**
    * 加密方式描述
    */
    @TableField(exist = false)
    private String subjectTypeDesc;

    public String getSubjectTypeDesc() {
        return subjectType == null ? null : subjectType.getDesc();
    }

    /**
     * 排序
     */
    private Integer sortNumber;

}
